import router from "@/router";
import {getToken} from "@/utils/auth";
router.beforeEach(async (to, from, next) => {
    next();
    const hasToken = getToken()
    if (hasToken) {
        if(to.path=='/'){
            next('/enter');
        }
        next()
    } else {
        if(['/identify','/ecode'].includes(to.path)){
            next();
        }else if(to.path!='/login'){
            next('/login')
        }
        next()
    }
})
